package kr.hkit.summary_java.erp;

import javax.swing.JMenu;
import javax.swing.JMenuItem;

public class ErpMenu extends JMenu {
	private static final long serialVersionUID = 1L;
	private String[] itemTitles={"추가","검색","수정","삭제","리스트"};
	private String[] menuItemTitle;
	
	public ErpMenu(String title) {
		super(title);
		menuItemTitle = new String[itemTitles.length];
		for(int i=0; i<itemTitles.length; i++){
			menuItemTitle[i]=title+" "+itemTitles[i];
		}
		initialize();
	}

	public ErpMenu(String title, String...subTitle) {
		super(title);
		menuItemTitle = new String[subTitle.length];
		for(int i=0; i<subTitle.length; i++){
			menuItemTitle[i]=title+" "+subTitle[i];
		}
		initialize();
	}
	
	private void initialize() {
		
		for(int i=0; i<menuItemTitle.length;i++){
			JMenuItem menuItem = new JMenuItem(menuItemTitle[i]);
			add(menuItem);
		}
		
	}

}
